;/*
; *	irq_init.s  --   init SP for irq_mode
; *	
; */

	AREA irq_sp_init, READONLY,CODE
	CODE32

; **********************************************************************
; * set sp_irq 0x33000000 for irq_mode.
; **********************************************************************
	EXPORT  irq_init
irq_init
	stmfd	sp!, {r0-r12, lr}        ; push r0-r12 register file and lr( pc return address )
	mrs	r4, SPSR
	stmfd sp!, {r4}
	
	mov r0, #0xd2               
	msr cpsr_cxsf, r0	//bug here,why?
	mov r13, #0x33000000
		
	mov r0,#0xd3
	msr cpsr_cxsf, r0
	ldmfd sp!, {r4}
	msr	 spsr_cxsf, r4
	ldmfd sp!, {r0-r12, pc}        ; recover r0-r12 and pc from stack, cpsr also
	
	end	